package com.tcd.customer.service.impl;


import com.tcd.customer.mapper.PolicyholdersInfoMapper;
import com.tcd.pojo.Client.PolicyholdersInfo;
import com.tcd.customer.service.PolicyholdersInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class PolicyholdersInfoServiceImpl implements PolicyholdersInfoService {

    @Resource
    PolicyholdersInfoMapper policyholdersInfoMapper;

    @Override
    public List<PolicyholdersInfo> getAll() {
        return policyholdersInfoMapper.getAll();
    }

    @Override
    public List<PolicyholdersInfo> query(String policyholdersName, String policyholdersId) {
        return policyholdersInfoMapper.query(policyholdersName, policyholdersId);
    }

    @Override
    public int addPolicyholdersInfo(PolicyholdersInfo policyholdersInfo) {
        String hecker_time=null;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        hecker_time=df.format(new Date());
        policyholdersInfo.setCreateTime(hecker_time);
        return policyholdersInfoMapper.addPolicyholdersInfo(policyholdersInfo);
    }

    @Override
    public int deleteRow(int policyholdersId) {
        return policyholdersInfoMapper.deleteRow(policyholdersId);
    }

    @Override
    public int amendRow(PolicyholdersInfo policyholdersInfo) {
        String hecker_time=null;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        hecker_time=df.format(new Date());
        policyholdersInfo.setUpdateTime(hecker_time);
        return policyholdersInfoMapper.amendRow(policyholdersInfo);
    }

    @Override
    public List<PolicyholdersInfo> getpolicyholdersName() {
        return policyholdersInfoMapper.getpolicyholdersName();
    }
}
